import AppSvgIcon from "./AppSvgIcon/Index.vue";
import AppDialog from "./AppDialog/Index.vue";
import AppDrawer from "./AppDrawer/Index.vue";
import AppToolbar from "./AppToolbar/Index.vue";
import AppTag from "./AppTag/Index.vue";
import AppSelectIcon from "./AppSelectIcon/Index.vue";
import AppUploadFiles from "./AppUpload/Files.vue";
import AppUploadImage from "./AppUpload/Image.vue";
import AppUploadImages from "./AppUpload/Images.vue";
import AppExcel from "./AppExcel/Index.vue";
import AppTagFilter from "./AppTagFilter/Index.vue";
import AppCard from "./AppCard/Index.vue";
import AppGlobalIcon from "./AppGlobalIcon/Index.vue";

import type { App, Component } from "vue";

/** 对外暴露插件对象，注册全局组件 */
const components: { [name: string]: Component } = {
  AppSvgIcon,
  AppDialog,
  AppDrawer,
  AppToolbar,
  AppTag,
  AppSelectIcon,
  AppUploadFiles,
  AppUploadImage,
  AppUploadImages,
  AppExcel,
  AppTagFilter,
  AppCard,
  AppGlobalIcon
};

export default {
  // install方法， Object.keys()得到对象所有的key
  install(app: App) {
    Object.keys(components).forEach((key: string) => {
      app.component(key, components[key]);
    });
  }
};
